package gui;

import excecoes.FalhaPersistenciaException;
import gui.util.GuiUtil;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;

public class Splash extends JWindow {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JLabel imagem = null;

	/**
	 * @param owner
	 */
	public Splash(Frame owner) {
		super(owner);
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(350, 150);
		this.setContentPane(getJContentPane());
		Dimension dimension = getToolkit().getScreenSize();
		this.setLocation((int)((dimension.getWidth()-this.getWidth())/2), (int)((dimension.getHeight()-this.getHeight())/2));
		try {
			imagem.setIcon(GuiUtil.getInstancia().getIcone("splash"));
		} catch (FalhaPersistenciaException e) {			
		}
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			imagem = new JLabel();
			imagem.setText("");
			imagem.setSize(new Dimension(350, 150));
			imagem.setLocation(new Point(0, 0));
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(imagem, null);
		}
		return jContentPane;
	}

}
